package com.etown.interceptor;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
/**
 * 全局拦截
 * @author knight
 *
 */
public class GlobalInterceptor implements Interceptor {

	public void destroy() {

	}

	public void init() {

	}

	public String intercept(ActionInvocation invocation) throws Exception {
		// 这里用来统计在线的注册用户和游客
		System.out.println("进入全局拦截器...");
		String result = invocation.invoke();
		System.out.println("全局拦截器执行完毕...");
//		Object userName=ActionContext.getContext().getSession().get("userName");
//		if(userName==null){
//			return "failure";
//		}else{
//			String result = invocation.invoke();
//			return result;
//		}
		return result;
	}
}